import { makeAutoObservable } from 'mobx'
import { setCookie, removeCookie } from '@/utils/auth'
import {  getLogin,getregistry } from '@/services'
import { inteLoginItem, intecaptrueImage} from '@/utils/interface'
class Login{
    constructor(){
        makeAutoObservable(this)
    }

    authorization:string = '';
   
    async getLogin(data:inteLoginItem){
        let result = await getLogin({...data})
        
        if(result.status == 200){
            
            let authorization = this.authorization = result.body.token;
            setCookie(authorization);
            return authorization
        }
    }
    async getregistry(data:inteLoginItem){
        let result = await getregistry({...data})
        console.log(result);
        
    }
    logout(){
        removeCookie();
        this.authorization = '';
    } 
}
export default new Login